package com.demo.expertsystemdemo.service.mongodb.simple;

import org.springframework.data.mongodb.core.MongoTemplate;

public class RemoveCollectionService {
    private final MongoTemplate mongoTemplate;

    public RemoveCollectionService(MongoTemplate mongoTemplate) {
        this.mongoTemplate = mongoTemplate;
    }

    /**
     * 删除【集合】
     *
     * @param collectionName 集合名称
     */
    public void removeCollection(String collectionName) {
        // 执行删除集合
        mongoTemplate.dropCollection(collectionName);
    }
}
